import 'package:xvideos/hj_model/comment/comment_model.dart';

// import '../comment_model.dart';

///评论列表返回信息
class CommentListRes {
  int? lfCount;
  List<CommentModel>? list;
  int? total;
  bool? hasNext = false;
  List<CommentLink>? quickSearchList;

  static CommentListRes fromJson(Map<String, dynamic>? map) {
    map ??= {};
    CommentListRes info = CommentListRes();
    info.lfCount = map['lfCount'];
    info.list = (map['list'] as List?)?.map((o) => CommentModel.fromJson(o)).toList();
    info.total = map['total'];
    info.hasNext = map['hasNext'];
    info.quickSearchList = (map['quickSearchList'] as List?)?.map((o) => CommentLink.fromJson(o)).toList();
    return info;
  }

  Map toJson() => {
        "lfCount": lfCount,
        "list": list,
        "total": total,
        "hasNext": hasNext,
      };
}

class CommentLink {
  String? id;
  String? title;
  String? searchKeyword;
  String? link;
  int? linkType; //1:内链跳转,2:外链跳转
  int? type; // 1:评论置顶,2:评论大家都在搜
  String? createdAt;

  int? userID;
  String? userName;
  String? userPortrait;
  int? gender;
  int? vipLevel;
  String? vipExpireDate;

  String get showVipLevelIcon {
    final vipl = vipLevel ?? 0;
    if (vipl == 0) return '';
    if (vipl == 3) return 'assets/images/nut/super_vip.png';
    return 'assets/images/nut/user_vip_small.png';
  }

  static CommentLink fromJson(Map<String, dynamic>? map) {
    map ??= {};
    CommentLink info = CommentLink();
    info.id = map['id'];
    info.title = map['title'];
    info.searchKeyword = map['searchKeyword'];
    info.link = map['link'];
    info.linkType = map['linkType'];
    info.type = map['type'];
    info.createdAt = map['createdAt'];

    info.userID = map['userID'];
    info.userName = map['userName'];
    info.userPortrait = map['userPortrait'];
    info.gender = map['gender'];
    info.vipLevel = map['vipLevel'];
    info.vipExpireDate = map['vipExpireDate'];

    return info;
  }
}
